﻿using UnityEngine;using System.Collections;public class MoveTrigger : Trigger {

    public Transform targetPositionObject;
    public float Duration = 3.0f;
    public bool CanPause = false;

    private bool isStarted = false;
    private bool isPause = false;    // Use this for initialization    void Start () {        }        // Update is called once per frame    void Update () {        }    public override void Do() {        base.Do();
        if (!isStarted) {
                iTween.MoveTo(gameObject, iTween.Hash(
                    "position", targetPositionObject.position,
                    "time", Duration,
                    "easeType", "linear",
                    "looptype", "pingPong"));
            isStarted = true;
        }
        else {
            if (isPause) {
                iTween.Resume(gameObject);
                isPause = false;
            }
            else if (CanPause) {
                iTween.Pause(gameObject);
                isPause = true;
            }

        }    }}